package org.sky.cloud.api.remote;


import org.sky.cloud.api.remote.request.Request;
import org.sky.cloud.api.remote.response.Response;

public interface Requester {
    
    /**
     * send request.
     *
     * @param request      request.
     * @param timeoutMills mills of timeouts.
     * @return response  response returned.
     */
    Response request(Request request, long timeoutMills) throws Exception;
    
    /**
     * send request.
     *
     * @param request request.
     * @return request future.
     */
    RequestFuture requestFuture(Request request) throws Exception;
    
    /**
     * send async request.
     *
     * @param request         request.
     * @param requestCallBack callback of request.
     */
    void asyncRequest(Request request, RequestCallBack requestCallBack) throws Exception;
    
    /**
     * close connection.
     */
    void close();
    
}
